package com.gpjcjl.ui;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.base.lib.IntentUtil;
import com.gpjcjl.BaseActivity;
import com.gpjcjl.R;
import com.gpjcjl.ui.fragment.SettingItem1;
import com.gpjcjl.ui.fragment.SettingItem10;
import com.gpjcjl.ui.fragment.SettingItem11;
import com.gpjcjl.ui.fragment.SettingItem2;
import com.gpjcjl.ui.fragment.SettingItem3;
import com.gpjcjl.ui.fragment.SettingItem4;
import com.gpjcjl.ui.fragment.SettingItem5;
import com.gpjcjl.ui.fragment.SettingItem6;
import com.gpjcjl.ui.fragment.SettingItem7;
import com.gpjcjl.ui.fragment.SettingItem8;
import com.gpjcjl.ui.fragment.SettingItem9;

import java.util.ArrayList;
import java.util.List;

import butterknife.OnClick;

public class SettingActivity extends BaseActivity {

    //    @BindView(R.id.content)
    //    View contentView;
    private List<View> menuItems = new ArrayList<>();

    @Override
    protected int getContentView() {
        return R.layout.activity_setting;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        menuItems.add(findViewById(R.id.item1));
        menuItems.add(findViewById(R.id.item2));
        menuItems.add(findViewById(R.id.item3));
        menuItems.add(findViewById(R.id.item4));
        menuItems.add(findViewById(R.id.item5));
        menuItems.add(findViewById(R.id.item6));
        menuItems.add(findViewById(R.id.item7));
        menuItems.add(findViewById(R.id.item8));
        menuItems.add(findViewById(R.id.item9));
        menuItems.add(findViewById(R.id.item10));
        menuItems.add(findViewById(R.id.item11));
    }

    @OnClick({R.id.item1, R.id.item2, R.id.item3, R.id.item4, R.id.item5,
            R.id.item6, R.id.item7, R.id.item8, R.id.item9, R.id.item10,
            R.id.item11})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.item1:
                IntentUtil.startIntent(mContext, SettingItem1.class);
                break;
            case R.id.item2:
                IntentUtil.startIntent(mContext, SettingItem2.class);
                break;
            case R.id.item3:
                IntentUtil.startIntent(mContext, SettingItem3.class);
                break;
            case R.id.item4:
                IntentUtil.startIntent(mContext, SettingItem4.class);
                break;
            case R.id.item5:
                IntentUtil.startIntent(mContext, SettingItem5.class);
                break;
            case R.id.item6:
                IntentUtil.startIntent(mContext, SettingItem6.class);
                break;
            case R.id.item7:
                IntentUtil.startIntent(mContext, SettingItem7.class);
                break;
            case R.id.item8:
                IntentUtil.startIntent(mContext, SettingItem8.class);
                break;
            case R.id.item9:
                IntentUtil.startIntent(mContext, SettingItem9.class);
                break;
            case R.id.item10:
                IntentUtil.startIntent(mContext, SettingItem10.class);
                break;
            case R.id.item11:
                IntentUtil.startIntent(mContext, SettingItem11.class);
                break;
            default:
                break;
        }
    }

    private void replaceItem(int viewId, Fragment fragment) {
        FragmentManager manager = getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        //        transaction.replace(R.id.content, fragment);
        //        transaction.commitNowAllowingStateLoss();
        //        for (View menuItem : menuItems) {
        //            if (menuItem.getId() == viewId) {
        //                menuItem.setBackgroundColor(getResources().getColor(R.color.c_42a8ff));
        //            } else {
        //                menuItem.setBackgroundColor(getResources().getColor(R.color.white));
        //            }
        //        }
    }
}
